package com.transaction.simulate.mapper;

import com.transaction.simulate.model.dto.Fund;
import com.transaction.simulate.model.dto.FundYield;
import com.transaction.simulate.model.vo.FundVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface FundMapper{

    void insertOrUpdateFund(@Param("channelCode") String channelCode,
                            @Param("fund") Map<String, Object> fund);

    void insertFund(Fund fund);

    void insertFundYield(@Param("channelCode") String channelCode,
                         @Param("transDate") String transDate,
                         @Param("dataList") List<Map<String, Object>> dataList);

    @Delete("delete from t_fundYield where channelCode = #{channelCode} and transDate = #{transDate}")
    void deleteFundYieldByChannelAndTransDate(@Param("channelCode") String channelCode,
                                              @Param("transDate") String transDate);

    void insertEveryDayFundYield(@Param("dataList") List<FundYield> list);

    void insertEveryDayFundNav(@Param("dataList") List<FundYield> list);

    List<FundYield> selectFundYieldListByFundType(@Param("fundType") String fundType);

    @Delete("delete from t_fundYield where channelCode = #{channelCode} and fundCode = #{fundCode} and transDate = #{transDate}")
    void deleteFundYieldByChannelFundAndTransDate(@Param("channelCode") String channelCode,
                                                  @Param("fundCode") String fundCode,
                                                  @Param("transDate") String transDate);

    List<FundVo> getFundList(@Param("channelCode") String channelCode,
                             @Param("fundCode") String fundCode);

    void deleteFund(Fund fund);

    void deleteFundYield(Fund fund);

    void insertFundYieldInit(FundYield fundYield);

}
